<template>
  <el-container>
    <!-- 左右布局 -->
    <!-- 侧边栏使用el-aside -->
    <el-aside class="nooverflow" v-bind:style="{ width: collapseWidth+'px'}">
      <el-container class='left_top_icon_bg'>
        <img
          src="../../resource/life_logo.png"
          style="height: 50px;width: 50px;margin: 0 5px;"
          class="marginLeftTen"
          v-on:click="showCollapse"
        />

        <img v-if="showCollapse" 
          style="width:120px;height:50px;margin-top:4px" src="../../resource/life_logo_text.png"/>

      </el-container>
      <div class="divMenu">
        <el-menu
          router
          text-color="#ffffff"
          unique-opened
          active-text-color="cccccc"
          class="el-menu-vertical-demo el-menu"
          background-color="#363636"
          :default-active="activityTab"
          :collapse="isCollapse"
          @select="selectItem"
          @open="clicksubmenu"
          @close="clicksubmenu"
        >
          <!--:key="index0" 修改为 :key="item.id"  by guo 2020-3-30-12:55修改--> 
          <template v-for="item in navList">
            <el-menu-item
              v-if="item.items==null"
              :key="item.id"
              :index="item.url!=undefined?item.url+'':item.id"
            >
              <!-- by guo 2019-09-29 修改为 :index="item.url!=undefined?item.url+'':item.id"   index应该是唯一的 否则会有bug-->
              <!-- :index="item.url!=undefined?item.url+'':index0+''" -->
              <i :class="item.icon" class="home_icon"></i>
              <span slot="title" style="margin-left:2px">{{item.name}}</span>
            </el-menu-item>
            <!--:key="index0" 修改为 :key="item.id"  by guo 2020-3-30-12:55修改-->  
            <el-submenu
              v-else
              :class="{'submenu':item.items==null}"
              :key="item.id"
              @click.native.prevent="clickSubmenu(item.url)"
              :index="item.url!=undefined?item.url+'':item.id"
            >
              <!-- by guo 2019-09-29 修改为 :index="item.url!=undefined?item.url+'':item.id"    index应该是唯一的 否则会有bug-->
              <!-- :index="item.url!=undefined?item.url+'':index0+''" -->
              <template slot="title">
                <i :class="item.icon!=null?item.icon:''" class="home_icon"></i>
                <span slot="title" style="margin-left:2px">{{item.name}}</span>
              </template>
              <!--:key="index1" 修改为 :key="item1.id"  by guo 2020-3-30-12:55修改--> 
              <el-menu-item-group>
                <label v-for="(item1,index1) in item.items" :key="item1.id">
                  <!-- by guo 2020-2-26-13:16添加 life项目菜单过长需要超出隐藏省略  -->
                  <!-- by guo 2020-3-31-12:48修改  :disabled="item1.tooltipDisabled" 修改为 :disabled="RoomGeneralViewManagement!='/RoomGeneralViewManagement'" -->
                  <el-tooltip :disabled="!isLife" class="el-tooltip-item" effect="dark" :content="item1.name" placement="right">
                  <!-- by guo 2020-3-30-12:20 注释  *****这个最多只能有二级菜单 没有扩展性**** -->
                  <!-- <el-menu-item :index="item1.url+''" >
                    <template slot="title">
                      <i :class="item1.icon" class="home_icon"></i>
                      <span ref="tooltip_span" slot="title" @mouseover="mouseOverTooltip(index1)">{{item1.name}}</span>
                    </template>
                  </el-menu-item> -->

                  <!-- by guo 2020-3-30-12:30  重构-->
                  <el-menu-item :index="item1.url+''" v-if="item1.items==null">
                    <template slot="title">
                      <i :class="item1.icon!=null?item1.icon:''" class="home_icon"></i>
                      <span ref="tooltip_span" slot="title" @mouseover="mouseOverTooltip(index1)">{{item1.name}}</span>
                    </template>
                  </el-menu-item>
                  <el-submenu
                      v-else
                      :class="{'submenu':item1.items==null}"
                      :key="item1.id"
                      @click.native.prevent="clickSubmenu(item1.url)"
                      :index="item1.id"
                    >
                     <template slot="title">
                      <i :class="item1.icon!=null?item1.icon:''" class="home_icon"></i>
                      <span slot="title" style="margin-left:2px">{{item1.name}}</span>
                      </template>
                      <!--:key="index2" 修改为 :key="item2.id"  by guo 2020-3-30-12:55修改--> 
                      <el-menu-item-group>
                        <label v-for="(item2,index2) in item1.items" :key="item2.id">
                        <!-- <el-tooltip :disabled="item2.tooltipDisabled" class="el-tooltip-item" effect="dark" :content="item2.name" placement="right"> -->
                        <el-menu-item :index="item2.url+''" v-if="item2.items==null" style="padding-left:40px;">
                          <template slot="title">
                            <i :class="item2.icon!=null?item2.icon:''" class="home_icon"></i>
                            <span ref="tooltip_span" slot="title" @mouseover="mouseOverTooltip(index2)">{{item2.name}}</span>
                          </template>
                        </el-menu-item>
                        <!-- </el-tooltip> -->
                        </label>
                      </el-menu-item-group>
                   </el-submenu>
                  </el-tooltip>
                </label>
              </el-menu-item-group>
            </el-submenu>
          </template>
        </el-menu>
      </div>
    </el-aside>
    <!-- 右边整个的布局 -->
    <el-container class="main-right">
      <!-- //头部使用el-container -->
      <el-header style="height:94px;">
        <el-row>
          <el-col style="margin:6px 10px 7px 0px;">
            <el-dropdown style="float:right;" @command="handleCommand">
              <div style="display: flex;align-items: center;">
                <!-- 测试字体 -->
                <!-- <span style="font-size:20px;margin-right:30px">新しい時代のこころを映すタイプフェイスデザイン</span> -->
                <img height="40" :src="headUrl" />
                <!-- <span class="textspan">{{roleName}}：{{uerName}}，{{main.welcomeToLogin}}</span> -->
                <!-- by guo 2020-2-25-12:45修改 只显示姓名-->
                <span class="textspan">{{uerName}}</span>
                <!-- by guo 2020-01-18-09-03修改  通过接口获取language来判断  因为用国际化语言引入会有问题 life日文化的项目会影响到原来的项目的语言 -->
                <!-- <span v-if="language=='zh_CN'" class="textspan">{{roleName}}：{{uerName}}，欢迎登录</span>
                <span v-else class="textspan">{{roleName}}：{{uerName}}，ログイン歓迎</span> -->
              </div>
              <el-dropdown-menu slot="dropdown">
                <!-- by guo 2019-12-18-16:22 修改 通过RoomGeneralViewManagement!='/RoomGeneralViewManagement'来判断是否显示和隐藏这个-->
                <!-- by guo 2020-2-26-11:21 添加   menuFlag==true  有菜单时才显示 -->
                <!-- <el-dropdown-item command="userInfo" v-if="menuFlag==true && !isLife">{{main.personalInformation}}</el-dropdown-item> -->
                <el-dropdown-item command="userInfo" v-if="false">{{main.personalInformation}}</el-dropdown-item>
                <el-dropdown-item command="signout">{{main.logOut}}</el-dropdown-item>
                <!-- by guo 2020-01-18-09-03修改  通过接口获取language来判断  因为用国际化语言引入会有问题 life日文化的项目会影响到原来的项目的语言 -->
                <!-- <el-dropdown-item v-if="language=='zh_CN'" command="signout">注销登录</el-dropdown-item>
                <el-dropdown-item v-else command="signout">登録抹消</el-dropdown-item> -->
              </el-dropdown-menu>
            </el-dropdown>
            <!-- <el-badge :value="alarmlogNum" class="item badge" v-if="menuFlag==true && !isLife"> -->
            <el-badge :value="alarmlogNum" class="item badge" v-if="false">
              <i class="el-icon-bell" style="color:black;font-size:30px;" @click="jumpAlarmlog" />
            </el-badge>
          </el-col>
          <el-col>
            <!--by guo 2019-12-22添加 判断为入院详情就不能再次点击 :disabled="item.path=='/OlderDetailAdd' && activityTab=='/OlderDetailAdd'" -->
            <el-tabs
              type="card"
              v-model="activityTab"
              closable
              @tab-remove="removeTab"
              @tab-click="clickTab"
            >
              <el-tab-pane
                v-for="(item) in this.$store.state.tabList"
                :key="item.path"
                :label="item.title"
                :name="item.path"
              ></el-tab-pane>
              
            </el-tabs>
          </el-col>
        </el-row>
      </el-header>

      <!-- by guo 2019-12-23-16:03添加 回到顶部-->
      <el-backtop target=".el-main" >
        <div>
          <img style="width:50px;height:50px" src="../assets/lifeGroupimg/backTop.png">
        </div>
      </el-backtop>


    
      <!-- by guo 2019-12-09-20:00 添加  life集团的项目才有这个 <el-main>和<el-aside-->
      <el-main style="padding-bottom:0px;padding-top:10px;width:83%;background:#f6f6f6;">
        <keep-alive :include="compListStr" class="content-wrapper el-menu">
          <router-view />
        </keep-alive>
      </el-main>
      <el-aside v-loading="lifeAlarmLoading" id='scrollDiv' :element-loading-text="main.lifeMainLoading" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" width="200px;" class="leftAside">
        <el-row class="row-lingdang">
          <el-col :span="6"><span :style="{color:titleBackground}" class="el-icon-message-solid row-lingdang-icon"></span></el-col>
          <el-col :span="18" align="left" :style="{color:titleBackground}">{{main.alarmTitle}}</el-col>
        </el-row>
        <!-- class="animate" 右侧报警栏 -->
        <el-row v-for="(item,index) in alarmTilteList" :key="index">
          <!-- <el-tooltip class="item" effect="dark" :content="item.alertInfo" placement="bottom">
            <el-col class="alarmMessage" :span="24" :style="{color:item.color}">{{item.alertInfo}}</el-col>
          </el-tooltip> -->
          <!-- by guo 2020-3-4-16:39修改 需求变更-->
          <el-tooltip class="item" effect="dark" :content="item.alertInfoTwo" placement="bottom">
            <!-- <el-col class="alarmMessage" :span="24" :style="{color:item.color}">{{item.alertInfoTwo}}</el-col> -->
            <!-- by fzq 2021-4-15-16:39 动态渲染颜色 -->
            <el-col class="alarmMessage" :span="24" :class="item.alertType==27?'blink':''"  :style="{color:(showColorByType(item.alertType)),'font-size':item.fontSize}">{{item.alertInfoTwo}}</el-col>
          </el-tooltip>
        </el-row>
      </el-aside>

    </el-container>
  </el-container>
</template>

<script>
import "../assets/icon/iconfont.css";
import bus from "../vuex/eventBus"; //引入eventBus,接收子界面传递的跳转指令,然后在父界面跳转,添加tab
import { WebsocketServerUrl } from "@/api/http.js";
export default {
  name: "Home",
  data() {
    return {
      main: this.$t("m.main"), //引入 lang 里面的字符串资源,
      headUrl:
        "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
      isCollapse: false, //是否收缩左侧的menu菜单栏
      collapseWidth: 200, //左侧的aside宽度,可以被修改的,动态Css
      selectItemTime: 0, //获取选中事件时间,和click 做一个长度差,防止重复点击,问题是由于点击子item,submenu的点击事件也触发了
      activityTab: "", //当前被选中的tab-item
      compList: [], //缓存的组件列表
      compListStr: "", //缓存的组件列表转成字符串,需要在主机的声明name;
      //tabList: [], //底部tab记录的数据
      alarmlogNum: "", //报警未处理数
      //模拟的菜单栏数据
      navList: [],
      uerName: "", //用户姓名
      roleName: "", //用户角色
      groupId: "",
      sysUserName: "", //by guo 2019-11-07_18:53添加
      username:'',
      password:'',
      roleCode:'',
      userId:null,
      tokenTime:null,
      selectItemFlag:"",//判断是左边的菜单是展开了父级菜单false    还是选择了菜单true
      // RoomGeneralViewManagement:"",//by guo 2019-12-10-18:40添加  用来判断是否是life集团的项目 
      acceptLanguage:'ja_JP',//数据请求传参需要传的语言  ja_JP----日文
      language:"",//语言 中或者日
      websock:"",
      menuFlag:"",//by guo 2020-2-26-11:18添加  用于判断是否有菜单
      isHuaLong: false,
      isLife: false,
      //life集团首页报警集合
      alarmTilteList:[],
      alertPageNo:1,//查询报警的分页
      alertPageTotal:2,//查询报警的全部有多少页
      titleBackground:"",//报警提示颜色
      lifeAlarmLoading:false,//life报警提示加载的loading
      alertColorList:[],//报警颜色
      alertList:[],//新的全部报警列表
    };
  },
  methods: {
    /* 
      菜单过长的鼠标经过时显示具体的菜单名
    */
    mouseOverTooltip(index1) {
      this.$refs.tooltip_span.forEach((item,index)=>{
        if(index==index1){
          this.navList.forEach(item2=>{
            if(item2.items!=null){
              item2.items.forEach(item3=>{
                item3.tooltipDisabled=item.offsetWidth>=120 ? false : true;
              })
            }
          }) 
        }
      })
    },
    //根据报警色列表渲染报警颜色
    showColorByType(type){
      var color = "rgba(247, 15, 7, 1)";
      for(var i=0;i<this.alertColorList.length;i++){
        if(type == this.alertColorList[i].alertType){
          color = this.alertColorList[i].color;
          break;
        }
      }
      return color;
    },
    //根据消息内容添加报警,追加到头部;
    addAlertFirstPosition(item){
      this.alarmTilteList.unshift(item);
    },
    //根据消息内容移除报警,遍历移除,可以移除多个
    rmAlertByList(list){
      list.forEach(function (id) {
        this.rmAlertById(id);
      })
    },
    //根据消息内容移除报警,遍历移除
    rmAlertById(id){
      for(var i=0;i<this.alarmTilteList.length;i++){
        if(id == this.alarmTilteList[i].id){
          this.alarmTilteList.splice(i,1);
          break;
        }
      }
    },
    //跳转到报警记录 by xiang
    jumpAlarmlog() {
      bus.$emit("homePage", {
        type: "jump",
        path: "/alarmlog",
        title: "报警记录"
      });
    },
    //获取未处理的报警信息
    getAlarmlogDetail() {
      this.$postJson("dmc/alert/queryDeviceAlertListWithPage", {
        pageNum: 1,
        pageSize: 65535
      }).then(res => {
        if (res.code == 100010) {
          this.$message({ message: res.message, type: "error" });
          this.$router.push({ path: "/login" });
        }
        let alarmlog = [];
        res.result.list.map(item => {
          if (item.handleStatus !== 1) {
            alarmlog.push(item);
          }
        });
        this.alarmlogNum = alarmlog.length;
      });
    },

    listtoStr() {
      var listStr = "";
      this.compList.forEach(item => {
        listStr = listStr + item + ",";
      });
      if (listStr.length > 0) {
        listStr = listStr.substr(0, listStr.length - 1);
      }
      this.compListStr = listStr;
      console.log(this.compListStr);
    },
    showCollapse() {
      this.isCollapse = !this.isCollapse;
      if (this.isCollapse) {
        this.collapseWidth = 60;
      } else {
        this.collapseWidth = 200;
      }
    },
    //选中menu-item的事件
    selectItem(item) {
      //获取时间
      //需要将该路由
      console.log(item)
      this.addTab(item);
      this.selectItemFlag=true
      if(this.selectItemFlag==true){
        sessionStorage.setItem("activityTab",item);//储存当前的tab选项卡的tab  by guo 2019-11-19-15:02
      }
    },
    // submenu的open和close事件
    clicksubmenu(url) {
      console.log(url);
    },
    //完成submenu的click事件
    clickSubmenu(url) {
      if (this.isCollapse && url != undefined && url != "" && url.length > 3) {
        this.$router.push({ path: url });
        this.addTab(url);
      }
    },
    //对于没有page展示的时候,显示默认的第一个page  by guo 2019-11-19-14:00修改  上面的注释掉  用这个  
    getFirstPage() {
      if (this.navList != null) {
        if (this.navList[0].url != undefined) {
          if(this.activityTab==0){
            if(this.navList[0].url == '/Nurse' || this.navList[0].url == '/Doctor'){
              this.$router.push({ path: this.navList[0].items[0].url });
              this.addTab(this.navList[0].items[0].url);
            }else{
              this.$router.push({ path: this.navList[0].url });
              this.addTab(this.navList[0].url);
            }
          }else{
            //获取当前路由,判断特殊情况,如果是子页面的子路由,则不跳转;
            if(this.activityTab == "/OlderDetailAdd"){
              if(this.$route.path =="/OlderDetailAddBaseTwo" || 
              this.$route.path =="/OlderDetailAddBase" || 
              this.$route.path =="/OlderDetailAddSelf" || 
              this.$route.path =="/OlderDetailAddService"|| 
              this.$route.path =="/OlderDetailAddEatBed"|| 
              this.$route.path =="/OlderDetailAddFee"|| 
              this.$route.path =="/OlderDetailAddFeeleyi"|| 
              this.$route.path =="/OlderDetailAddPeriod"){
                return;
              }
            }
            this.$router.push({ path: this.activityTab });
            this.addTab(this.activityTab);
          }
          this.activityTab = this.activityTab=='' ? this.navList[0].url : this.activityTab;
          this.addRouterInclude(this.navList[0].url);
        } else {
          if(this.activityTab==0){
            this.$router.push({ path: this.navList[0].items[0].url });
            this.addTab(this.navList[0].items[0].url);
            
          }else{
            this.$router.push({ path: this.activityTab });
            this.addTab(this.activityTab);
          }
          this.activityTab = this.activityTab=='' ? this.navList[0].items[0].url : this.activityTab;
          this.addRouterInclude(this.navList[0].items[0].url);
        }
      }
    },
    //给Tab添加tab-item
    //针对没有
    addTab(tabpath) {
      console.log(tabpath,this.$store.state.tabList)
      //是否存在相同的tab-item
      var isHaveSameItem = false;
      this.$store.state.tabList.forEach(item => {
        if (tabpath == item.path) {
          isHaveSameItem = true;
          this.activityTab = tabpath;
        }
      });
      console.log(isHaveSameItem)
      //如果不存在,则可以添加新的tab-item
      if (!isHaveSameItem) {
        console.log("菜单不存在")
        //需要遍历第一层和第二层
        this.navList.forEach(item => {
          if (item.url == tabpath) {
            this.$store.state.tabList.push({
              path: item.url,
              id: item.name,
              title: item.name
            });
            this.activityTab = item.url;
            this.addRouterInclude(item.url);
          } else {
            console.log("进了else")
            var items = item.items;
            if (items != null) {
              items.forEach(item1 => {
                if (item1.url == tabpath) {
                  this.$store.state.tabList.push({
                    path: item1.url,
                    id: item1.name,
                    title: item1.name
                  });
                  this.activityTab = item1.url;
                  this.addRouterInclude(item1.url);
                }
                //by guo 2020-3-30-14:50添加  因为现在有3级菜单了  需要再循环一次取到3级菜单的数据
                if(item1.items!=null){
                  item1.items.forEach(item2 => {
                    if (item2.url == tabpath) {
                      this.$store.state.tabList.push({
                        path: item2.url,
                        id: item2.name,
                        title: item2.name
                      });
                      this.activityTab = item2.url;
                      this.addRouterInclude(item2.url);
                    }
                  });
                }
              });
            }
          }
        });
      }
    },
    //删除tab的点击事件
    removeTab(targetName) {
      console.log(targetName);
      var removeindex = 0;
      for (let i = 0; i < this.$store.state.tabList.length; i++) {
        if (this.$store.state.tabList[i].path == targetName) {
          this.$store.state.tabList.splice(i, 1);
          removeindex = i;
          this.removeRouterInclude(targetName);
          break;
        }
      }
      //如果没有tab,则跳转到第一个页面
      if (this.$store.state.tabList.length == 0) {
        this.getFirstPage();
      } else {
        //判断当前的页面
        //如果不是,则不跳转
        //如果是被删除的页面
        //则加载上一个页面
        console.log(this.$store.state.tabList);
        console.log(removeindex);
        //       console.log(this.$route.path);
        //       由于部分界面是子页面url
        //      if(targetName.indexOf(this.$store.state.tabList[i].path) != -1){
        console.log(this.$route.path);

        if (this.$route.path.indexOf(targetName) != -1) {
          if (removeindex != 0) {
            this.activityTab = this.$store.state.tabList[removeindex - 1].path;
            this.$router.push({ path: this.$store.state.tabList[removeindex - 1].path });
            sessionStorage.setItem('activityTab',this.activityTab);//by guo 2019-11-19-14:15添加  储存右边tab 选项卡的选中的项
          } else {
            this.activityTab = this.$store.state.tabList[0].path;
            this.$router.push({ path: this.$store.state.tabList[0].path });

            sessionStorage.setItem('activityTab',this.activityTab);//by guo 2019-11-19-14:15添加  储存右边tab 选项卡的选中的项
          }
        }
      }
    },
    //点击tab的事件
    clickTab(targetName) {
      this.$router.push({ path: targetName.name });
      this.activityTab = targetName.name;
      sessionStorage.setItem('activityTab',this.activityTab);//by guo 2019-11-19-14:15添加   储存右边tab 选项卡的选中的项
    },
    //处理头像的下拉菜单的点击事件
    handleCommand(command) {
      console.log(command,"command");
      if (command == "userInfo") {
        //手动添加不存在navList内的tab
        this.addOtherRouter("/userInfo", "个人信息");
      } else if (command == "signout") {
        //退出登录
        //this.$store.commit("logout");
        // this.$router.push({ path: "/login" });
        //by guo 2019-11-09-9:35修改
        console.log(this.username,this.password,this.check,"获取的账号和密码");
        this.$router.push({name:'login',params:{username:this.username,password:this.password,check:this.check}});
        //by guo 2019-11-20-23:07退出登录时清除store 清空tabList的值  清除activityTab   初始化再次登录的tab栏的数据
        sessionStorage.removeItem('store');
        this.$store.state.tabList=[];
        sessionStorage.removeItem('activityTab');
        sessionStorage.removeItem('scheduleActiveName');//by guo 2020-7-16-16:32 添加
        sessionStorage.removeItem('musername');
        sessionStorage.removeItem('mpassword');
      }
    },
    //根据url添加
    addRouterInclude(url) {
      // if(this.compList.length>0){//by guo 2020-3-30-10:28注释  
        console.log(this.compList.indexOf(url.substring(1, url.length)));
        if (this.compList.indexOf(url.substring(1, url.length)) == -1) {
          this.compList.push("" + url.substring(1, url.length));
          this.listtoStr();
        }
      // }
    },
    //根据URL移除
    removeRouterInclude(url) {
      if (this.compList.indexOf(url.substring(1, url.length)) != -1) {
        console.log("remove");
        /**
         * 从keep-alive的 缓存页面数据中根据index删除页面
         * 使得页面不被缓存起来
        */
        this.compList.splice(
          this.compList.indexOf(url.substring(1, url.length)),
          1
        );
        this.listtoStr();
      }
    },
    //添加其他的路由到tab中
    addOtherRouter(url, title, paramdata) {
      var isHaveSameItem = false;
      this.$store.state.tabList.forEach(item => {
        if (url == item.path) {
          isHaveSameItem = true;
          this.activityTab = url;
        }
      });
      //如果不存在,则可以添加新的tab-item
      if (!isHaveSameItem) {
        this.$store.state.tabList.push({
          path: url,
          id: "" + url,
          title: "" + title
        });
        //启动include缓存
        // this.addRouterInclude(url);
      }
      // query:
      this.$router.push({ path: url, params: paramdata, query: paramdata });
      this.activityTab = url;
      sessionStorage.setItem('activityTab',this.activityTab);//by guo 2019-11-19-14:15添加  储存右边tab 选项卡的选中的项
    },
    /**
     * 删除指定的removeName的页面
     * 显示showName页面
     */
    removeRouterThenshowOther(removeName, showName) {
      var removeindex = 0;
      for (let i = 0; i < this.$store.state.tabList.length; i++) {
        if (this.$store.state.tabList[i].path == removeName) {
          removeindex = i;
          this.$store.state.tabList.splice(i, 1);
          this.removeRouterInclude(removeName);
          break;
        }
      }
      //如果没有想好的跳转,则显示上一个界面
      if (showName == "" || showName == null) {
        //如果没有tab,则跳转到第一个页面
        if (this.$store.state.tabList.length == 0) {
          this.getFirstPage();
        } else {
          //判断当前的页面
          //如果不是,则不跳转
          //如果是被删除的页面
          //则加载上一个页面
          if (removeindex != 0) {
            this.activityTab = this.$store.state.tabList[removeindex - 1].path;

            this.$router.push({ path: this.$store.state.tabList[removeindex - 1].path });
          } else {
            this.activityTab = this.$store.state.tabList[0].path;
            this.$router.push({ path: this.$store.state.tabList[0].path });
            sessionStorage.setItem('activityTab',this.activityTab);//by guo 2019-11-19-14:15添加   储存右边tab 选项卡的选中的项
          }
        }
      } else {
        this.activityTab = showName;
        this.$router.push({ path: showName });
        sessionStorage.setItem('activityTab',this.activityTab);//by guo 2019-11-19-14:15添加  储存右边tab 选项卡的选中的项
      }
    },
    //根据子页面传递过来的Page信息来切换显示,跳转子页面
    //不在子页面写跳转是为了要添加tab
    geteventBusMshJump(msg) {
      //添加已经存在navList内的tab
      if (msg.type == "add") {
        //子界面通知主页面 使用keep-alive缓存 路由 将该路由添加到keep-alive的缓存序列中
        //示例 admissionOperation界面
        //示例如 一般需要延长1000ms执行可以缩短点,但是不能立马执行 否则keep-alive删除失败 bus.$emit('homePage',{type:'add',path:'/admissionOperation'});
        this.addRouterInclude(msg.path);
      } else if (msg.type == "jump") {
        //跳转到指定界面 子界面点击按钮给主页传该数据,然后就可以跳转,;由于是详情页,所以没有缓存路由
        //这种跳转需要判断是否需要清除keep-alive,针对需要清除的,调用remove()方法清除keep-alive;
        //示例入orderList的 bus.$emit('homePage',{type:'jump',path:'/admissionOperation',params:params,title:'入院详情'});
        this.removeRouterInclude(msg.path);
        console.log(msg);
        this.addOtherRouter(msg.path, msg.title, msg.params);
      } else if (msg.type == "remove") {
        //需要移除该界面
        //显示上一个界面
        //用法示例 bus.$emit('homePage',{type:'remove',path:'/OlderDetail',showpath:'/OlderList'});
        //指定移除OlderDetail的tab,跳转到OlderList界面
        console.log(msg);
        this.removeRouterThenshowOther(msg.path, msg.showpath);
      } else if (msg.type == "alartMsgChange") {
        //刷新报警次数 by xiang
        this.getAlarmlogDetail();
      } else if(msg.type == "websocket"){
        //让 main 发生websocket;
        this.websocketsend(msg.content)
      }
    },
    /**
     * 获取菜单栏的数据列表
     * 多层级数据,结构分为子菜单,目前设计的是2层;
     */
    getPageData() {
      /**
       * url放在res/ports.js 同一管理
       * 按照页面分类
       */
      this.$post(this.ports.menu.menugettree, {}).then(res => {
        if (res.length != 0) {
          this.showMenuTree(res[0].subMenu);
          //by guo 2019-12-10-18:35添加  通过菜单RoomGeneralViewManagement来判断是否是life集团的项目
          // res[0].subMenu.forEach(item=>{
          //   if(item.url=="/RoomGeneralViewManagement"){
          //     this.RoomGeneralViewManagement=item.url;
          //   }
          // })
          this.menuFlag=true;//by guo 2020-2-26-11:17添加  用来判断是否有菜单  true--有  false--无
        } else {
          // this.$message.error("暂无菜单,请先添加菜单");
          this.menuFlag=false;//by guo 2020-2-26-11:17添加  用来判断是否有菜单  true--有  false--无
        }
      });
    },
    /* 
      获取登录用户的groupId 
    */
    getUserData() {
      this.$postForm("omc/group/getUserLongDetail", {}).then(response => {
        this.$postForm('uac/group/queryById/'+response.result.groupId)
          .then(res => {
            sessionStorage.setItem('groupCode', res.result.groupCode)
            if(res.result.groupCode == 'hua_long'){
              this.isHuaLong = true
            }else{
              // window.sessionStorage.setItem('isLife',false);
              // this.isLife = false
              this.isHuaLong = false
            }
            this.getIcon();
            this.getTitle();
          })
        // localStorage.setItem('groupId',response.result.groupId)
        /* by guo 2019-08-13 修改  这里不能用localStorage ,会有bug  下一个页面的回覆盖上一个页面的值  导致获取的值错乱*/
        this.groupId=response.result.groupId;//by guo 2020-3-23-13:34添加
        this.queryLanguage(this.groupId);//by guo 2020-3-23-13:34添加 获取机构的语言  中文或者其他语言
        sessionStorage.setItem("groupId", response.result.groupId);
        this.uerName = response.result.realName;
        this.roleName = response.result.roleName;
        var userNameX =response.result.userName;
        //by guo 2019-10-29 11：09 添加 因为websocket 请求参数由 groupId 变更为  userId  用于websocket请求数据
        sessionStorage.setItem("userId", response.result.userId);//by guo 2020-1-21-14:56注释
        sessionStorage.setItem("realName",this.uerName);
        this.userId=response.result.userId;
        //by guo 2019-11-09-9:48添加
        this.getCookie(userNameX);
        this.checkstatus(userNameX);
        this.initWebSocket();
      });
    },

    //获取cookie值
    getCookie: function(name) {
      if (document.cookie.length > 0) {
        var arr = document.cookie.split("; "); //这里显示的格式需要切割一下自己可输出看下
        for (var i = 0; i < arr.length; i++) {
          var arr2 = arr[i].split("="); //再次切割
          //判断查找相对应的值
          if (arr2[0] == "userName" + name) {
            this.username = arr2[1]; //保存到保存数据的地方
          } else if (arr2[0] == "userPwd" + name) {
            this.password = arr2[1];
            //对密码进行解密操作  by guo 2020-5-6-17:26添加
            this.password = JSON.parse(this.$Utils.demoResponse(this.password));
          }
        }
      }
    },

    //存储记住密码checkbox的值
    checkstatus(name) {
      // var checkstatus = localStorage.getItem("check" + name);
      //by guo 2019-11-09-10:38修改 不能使用localStorage  会覆盖之前的登录的信息  用sessionStorage就不会存在这样的问题
      var checkstatus = sessionStorage.getItem("check" + name);
      if(checkstatus != null &&　checkstatus!=undefined && checkstatus !='undefined'){
        this.check = JSON.parse(checkstatus);
      }
    },

    /* 
      获取登录用户的护工组id
    */
    getNursingGroupId() {
      this.$postForm("omc/group/selectNursingGroupId").then(response => {
        // localStorage.setItem('nursingGroupId',response.result)
        /* by guo 2019-08-13 修改  这里不能用localStorage ,会有bug  下一个页面的回覆盖上一个页面的值  导致获取的值错乱*/
        sessionStorage.setItem("nursingGroupId", response.result);
      });
    },
    //请求第一页的数据
    queryAlertFirstPage(){
      if(this.lifeAlarmLoading){
        return;
      }
      this.lifeAlarmLoading=true;
      this.$postJson("dmc/alert/queryLifeAlertWithPage",{
        pageNum:1,
        pageSize:100
      },this.acceptLanguage).then(res =>{
        this.alertPageTotal = res.result.pages;
        this.lifeAlarmLoading=false;
        var addAlertList = [];
        res.result.list.forEach(item=>{
            switch(item.alertType){
              case 10:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_ten;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_ten;
                }
                break;                  
              case 11:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_eleven;
                break;
              case 12:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twelve;
                break;
              case 13:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_thirteen;
                break;
              case 14:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fourteen;
                break;
              case 15:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fifteen;
                break;
              case 16:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_sixteen;
                break;
              case 17:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_seventeen;
                break;
              case 20:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twenty;
                break;
              case 21:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyone;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentyone;
                }
                break;
              case 22:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentytwo;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentytwo;
                }
                break;
              case 23:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentythree;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentythree;
                }
                break;
              case 24:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyfour;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentyfour;
                }
              break;
              case 27:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyseven;
                  // item.fontSize
                  if(item.fontSize == '0'){
                    item.fontSize = '12px'; 
                  }else if(item.fontSize == '1'){
                    item.fontSize = '14px'; 
                  }else if(item.fontSize == '2'){
                    item.fontSize = '16px'; 
                  }else if(item.fontSize == '3'){
                    item.fontSize = '18px'; 
                  }else if(item.fontSize == '4'){
                    item.fontSize = '20px'; 
                  }else if(item.fontSize == '5'){
                    item.fontSize = '22px'; 
                  }else if(item.fontSize == '6'){
                    item.fontSize = '24px'; 
                  }
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentyseven;
                }
                break;
            }
            //去重
            addAlertList.push(item);
        });
        addAlertList.forEach(item=>{
          this.alarmTilteList.unshift(item);
        });
      }).catch(err =>{
        this.lifeAlarmLoading = false;
      });
    },

    queryAllAlert(){
      if(this.lifeAlarmLoading){
        return;
      }
      this.lifeAlarmLoading=true;
      this.$postJson("dmc/alert/queryLifeAlertWithPage",{
        pageNum:1,
        pageSize:this.alertPageNo*100
      },this.acceptLanguage).then(res=>{
        this.alertPageTotal = res.result.pages;
        this.lifeAlarmLoading=false;
        res.result.list.forEach(item=>{
           switch(item.alertType){
              case 10:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_ten;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_ten;
                }
                break;                  
              case 11:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_eleven;
                break;
              case 12:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twelve;
                break;
              case 13:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_thirteen;
                break;
              // case 14:
              //   item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fourteen;
              //   break;
              case 15:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fifteen;
                break;
              case 16:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_sixteen;
                break;
              case 17:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_seventeen;
                break;
              case 20:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twenty;
                break;
              case 21:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyone;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentyone;
                }
                break;
              case 22:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentytwo;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentytwo;
                }
                break;
              case 23:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentythree;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentythree;
                }
                break;
              case 24:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyfour;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentyfour;
                }
                break;
              case 27:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyseven;
                  // item.fontSize
                  if(item.fontSize == '0'){
                    item.fontSize = '12px'; 
                  }else if(item.fontSize == '1'){
                    item.fontSize = '14px'; 
                  }else if(item.fontSize == '2'){
                    item.fontSize = '16px'; 
                  }else if(item.fontSize == '3'){
                    item.fontSize = '18px'; 
                  }else if(item.fontSize == '4'){
                    item.fontSize = '20px'; 
                  }else if(item.fontSize == '5'){
                    item.fontSize = '22px'; 
                  }else if(item.fontSize == '6'){
                    item.fontSize = '24px'; 
                  }
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentyseven;
                }
                break;
            } 
        });
        this.alarmTilteList=res.result.list;
      }).catch(err =>{
        this.lifeAlarmLoading=false;
      })

    },
    //分页查询报警,获取全部报警,在滑动的时候调用;
    queryAlertPage(){
      if(this.lifeAlarmLoading){
        return;
      }
      if(this.alertPageNo>this.alertPageTotal){
        return;
      }
      this.lifeAlarmLoading=true;
      this.$postJson("dmc/alert/queryLifeAlertWithPage",{
        pageNum:this.alertPageNo,
        pageSize:100
      },this.acceptLanguage).then(res=>{
        this.alertPageTotal = res.result.pages;
        this.lifeAlarmLoading=false;
        var addAlertList = [];
        if(this.alarmTilteList.length<21){
          res.result.list.forEach(item=>{
            switch(item.alertType){
              case 10:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_ten;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_ten;
                }
                break;                  
              case 11:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_eleven;
                break;
              case 12:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twelve;
                break;
              case 13:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_thirteen;
                break;
              case 14:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fourteen;
                break;
              case 15:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fifteen;
                break;
              case 16:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_sixteen;
                break;
              case 17:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_seventeen;
                break;
              case 20:
                item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twenty;
                break;
              case 21:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyone;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentyone;
                }
                break;
              case 22:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentytwo;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentytwo;
                }
                break;
              case 23:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentythree;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentythree;
                }
                break;
              case 24:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyfour;
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentyfour;
                }
                break;
              case 27:
                if(item.location!="" && item.location!=null && item.location!=undefined){
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyseven;
                  // item.fontSize
                  if(item.fontSize == '0'){
                    item.fontSize = '12px'; 
                  }else if(item.fontSize == '1'){
                    item.fontSize = '14px'; 
                  }else if(item.fontSize == '2'){
                    item.fontSize = '16px'; 
                  }else if(item.fontSize == '3'){
                    item.fontSize = '18px'; 
                  }else if(item.fontSize == '4'){
                    item.fontSize = '20px'; 
                  }else if(item.fontSize == '5'){
                    item.fontSize = '22px'; 
                  }else if(item.fontSize == '6'){
                    item.fontSize = '24px'; 
                  }
                }else{
                  item.alertInfoTwo=this.main.lifeAlart_twentyseven;
                }
                break;
            } 
            addAlertList.push(item);
          });
        }else{
          var endAlertList = this.alarmTilteList.slice(-20);
          res.result.list.forEach(item=>{
            var isSame = false;
            for(var k=0;k<endAlertList.length;k++){
              if(endAlertList[k].id == item.id){
                isSame = true;
              }
            }
            if(!isSame){
              switch(item.alertType){
                case 10:
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_ten;
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_ten;
                  }
                  break;                  
                case 11:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_eleven;
                  break;
                case 12:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twelve;
                  break;
                case 13:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_thirteen;
                  break;
                case 14:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fourteen;
                  break;
                case 15:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fifteen;
                  break;
                case 16:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_sixteen;
                  break;
                case 17:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_seventeen;
                  break;
                case 20:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twenty;
                  break;
                case 21:
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyone;
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_twentyone;
                  }
                  break;
                case 22:
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentytwo;
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_twentytwo;
                  }
                  break;
                case 23:
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentythree;
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_twentythree;
                  }
                  break;
                case 24:
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyfour;
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_twentyfour;
                  }
                  break;
                case 27:
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyseven;
                    // item.fontSize
                  if(item.fontSize == '0'){
                    item.fontSize = '12px'; 
                  }else if(item.fontSize == '1'){
                    item.fontSize = '14px'; 
                  }else if(item.fontSize == '2'){
                    item.fontSize = '16px'; 
                  }else if(item.fontSize == '3'){
                    item.fontSize = '18px'; 
                  }else if(item.fontSize == '4'){
                    item.fontSize = '20px'; 
                  }else if(item.fontSize == '5'){
                    item.fontSize = '22px'; 
                  }else if(item.fontSize == '6'){
                    item.fontSize = '24px'; 
                  }
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_twentyseven;
                  }
                  break;
              }
              //去重
              addAlertList.push(item);
            }
          });
        }
        addAlertList.forEach(item=>{
          this.alarmTilteList.push(item);
        });
      }).catch(err =>{
        this.lifeAlarmLoading=false;
      })
    },

    /* 
      life集团 首页报警提示  by guo 2019-12-27-16:47添加
    */
    queryDeviceAlertLife(){
      // if(this.RoomGeneralViewManagement!='/RoomGeneralViewManagement'){
      //   return;
      // }
      if(this.lifeAlarmLoading){
        return;
      }
      this.lifeAlarmLoading=true;
      this.$postJson(this.ports.roomGeneralViewManagement.queryDeviceAlertLife,{},this.acceptLanguage).then(res=>{
        console.log(res,"life首页报警提示");
        this.lifeAlarmLoading=false;
        this.alarmTilteList=[];//请求之前清空数据
        if(res.code==200){
          if(res.result!=null && res.result.length!=0){
            res.result.forEach(item=>{
              switch(item.alertType){
                //by guo 2020-3-16-14:57添加
                case 10:
                  // item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_ten;
                  //by guo 2020-3-19-12:39修改 需要判断是否绑定了房间
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_ten;
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_ten;
                  }
                  break;                  
                case 11:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_eleven;
                  break;
                case 12:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twelve;
                  break;
                case 13:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_thirteen;
                  break;
                case 14:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fourteen;
                  break;
                case 15:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fifteen;
                  break;
                case 16:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_sixteen;
                  break;
                case 17:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_seventeen;
                  break;
                //by guo 2020-3-9-11:56注释  需求变更  呼吸和心跳又合并为1个
                // case 18:
                //   item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_eighteen;
                //   break;
                case 20:
                  item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twenty;
                  break;
                //by guo 2020-3-13-12:54添加摄像头离线报警
                case 21:
                  //item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyone;
                  //by guo 2020-3-19-12:39修改 需要判断是否绑定了房间
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyone;
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_twentyone;
                  }
                  break;
                //by guo 2020-3-16-14:57添加
                case 22:
                  //item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentytwo;
                  //by guo 2020-3-19-12:39修改 需要判断是否绑定了房间
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentytwo;
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_twentytwo;
                  }
                  break;
                //by guo 2020-3-16-14:57添加
                case 23:
                  //item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentythree;
                  //item.alertInfoTwo=this.main.lifeAlart_twentythree;//by guo 2020-3-17-14:04修改  网关没有绑定房间  因此不需要拼接
                  //by guo 2020-3-19-12:39修改  需求变更  网关可以绑定房间   需要判断是否绑定了房间
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    // let locationTxt=item.location.split('-')[2];//by guo 2020-3-20-15:04修改  网关返回的是楼栋-楼层-房间   截取房间号
                    //item.alertInfoTwo=locationTxt+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentythree;
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentythree;
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_twentythree;
                  }
                  break;
                //by guo 2020-3-16-14:57添加
                case 24:
                  //item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyfour;
                  //by guo 2020-3-19-12:39修改 需要判断是否绑定了房间
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyfour;
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_twentyfour;
                  }
                  break;
                case 27:
                  if(item.location!="" && item.location!=null && item.location!=undefined){
                    item.alertInfoTwo=item.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyseven;
                   // item.fontSize
                  if(item.fontSize == '0'){
                    item.fontSize = '12px'; 
                  }else if(item.fontSize == '1'){
                    item.fontSize = '14px'; 
                  }else if(item.fontSize == '2'){
                    item.fontSize = '16px'; 
                  }else if(item.fontSize == '3'){
                    item.fontSize = '18px'; 
                  }else if(item.fontSize == '4'){
                    item.fontSize = '20px'; 
                  }else if(item.fontSize == '5'){
                    item.fontSize = '22px'; 
                  }else if(item.fontSize == '6'){
                    item.fontSize = '24px'; 
                  }
                  }else{
                    item.alertInfoTwo=this.main.lifeAlart_twentyseven;
                  }
                  break;
              }
            })
            this.alarmTilteList=res.result;
          }else{
            this.alarmTilteList=[];
          }
        }
      }).catch(err =>{
        this.lifeAlarmLoading=false;
      })
    },
    /* 
     * life集团右侧报警提示铃铛图片和文字的颜色
     */
    querylifeAlarmColor(){
      this.$postJson(this.ports.facilityManagement.queryAlarmColor,{},this.acceptLanguage).then(res=>{
        console.log(res);
        this.titleBackground="";//先清空数据
        if(res.code==200){
          for(var i=0;i<res.result.length;i++){
            if(res.result[i].hintTypeId==3){//3---警報語
              this.titleBackground=res.result[i].color;
              break;
            }
          }
        }else{
          this.titleBackground="";
        }
      })

      //查询报警色
      this.$postJson("dmc/alert/selectColorByAlertType",{},this.acceptLanguage).then(res=>{
        if(res.code==200){
          this.alertColorList = res.result;
        }else{
          this.alertColorList = [];
        }
      });

    },

    /* 
      根据机构查询语言
    */
    queryLanguage(groupId){
      if(groupId == null){
        return;
      }
      this.$postForm("uac/language/queryByGroupId/"+groupId,{},this.acceptLanguage).then(res=>{
        console.log(res,"根据机构查询语言");
        if(res.code==200){
          this.language=res.result.language;
          console.log(this.language,"language");
          sessionStorage.setItem("language",res.result.language);
        }
      })
    },

    showMenuTree(list) {
      this.navList=this.changeTree(list);
      this.getFirstPage();
    },
    /* 
      *by guo 2020-3-30-11:54添加  
      *tree树菜单的递归  
    */
    changeTree(val) {
      let arr = [];
      var indess = 0;
      if (val.length !== 0) {
        val.forEach(item => {
          let obj = {};
          obj.id = item.id;
          obj.name = item.menuName;
          obj.icon = item.icon
          obj.url =(item.url==null || item.url=='') ? indess : item.url;
          indess++;
          if (item.subMenu!=null && item.subMenu.length >= 1) {
            obj.items = this.changeTree(item.subMenu);
          }
          arr.push(obj);
        });
      }
      return arr;
    },
    //登录
    getToken() {
      this.isLife = window.sessionStorage.getItem('isLife');
      let password = JSON.parse(this.$Utils.demoResponse(window.sessionStorage.getItem("mpassword")));
			var loginParams =  {
        	username: window.sessionStorage.getItem('musername'),
        	password: password
      };
      this.$postLogin('uac/auth/form',loginParams,this.acceptLanguage)
        .then(response => {
          window.sessionStorage.setItem(
          "Authorization",
          "Bearer " + response.access_token
        );
      });
    },

    //websocket报警记录推送  by guo 2019 3-21 添加
    //初始化weosocket
    initWebSocket() {
      // var sn = window.sessionStorage.getItem("groupId");
      // var sn = window.sessionStorage.getItem("userId"); //by guo 2019-10-29-11:12  请求参数有groupId变更为userId
      var sn = this.userId; //by guo 2019-10-29-11:12  请求参数有groupId变更为userId
      console.log(sn);
      if ("WebSocket" in window) {
        //判断groupId是否存在
        //判断userId是否存在  by guo 2019-10-29 11：14变更
        //by guo 2019-12-06-10:42 修改 只需要判断sn是否为null  为null就不调用websocket
        // if (typeof sn != "undefined" || sn != "null" || sn != "") {
        // if (typeof sn != "null") {//by guo 2020-1-21-17:02修改
        if (sn!= null) {
          this.websock = new WebSocket(
            WebsocketServerUrl.webSocketServer + "/" + sn
          );
          console.log(this.websock);
          this.websock.onmessage = this.websocketonmessage;
          this.websock.onopen = this.websocketonopen;
          this.websock.onerror = this.websocketonerror;
          this.websock.onclose = this.websocketclose;
        }
      } else {
        this.$message({
          message:
            "当前浏览器不支持使用websocket，建议使用chrome或者火狐浏览器！",
          type: "error"
        });
      }
    },
    //打开时
    websocketonopen() {
      //连接建立之后执行
      console.log("websocket连接成功", new Date());
      //重新请求接口
      // 和上一次请求的时间太近则不查询
      this.queryAllAlert();
      //发送bus
      this.$bus.$emit("changeLifeAlarm_websocket");//life集团的刷新房间一览 详情页面的老人在离房状态和设备未知的数据

    },
    //报错时
    websocketonerror() {
      //连接建立失败重连
      console.log("websocket连接失败");
      setTimeout(() => {
        this.initWebSocket();
        console.log("socket正在重连...");
      }, 500);
    },
    //获取推送的报警内容,然后对应的都加进去
    addAlertByMsg(alertItem){
      switch(alertItem.alertType){
        case 10:
          if(alertItem.location!="" && alertItem.location!=null && alertItem.location!=undefined){
            alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_ten;
          }else{
            alertItem.alertInfoTwo=this.main.lifeAlart_ten;
          }
          this.addAlertFirstPosition(alertItem)
          break;                  
        case 11:
          alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_eleven;
          alertItem.color = this.showColorByType(alertItem.alertType);
          this.addAlertFirstPosition(alertItem)
          break;
        case 12:
          alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twelve;
          alertItem.color = this.showColorByType(alertItem.alertType);
          this.addAlertFirstPosition(alertItem)
          break;
        case 13:
          alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_thirteen;
          alertItem.color = this.showColorByType(alertItem.alertType);
          this.addAlertFirstPosition(alertItem)
          break;
        // case 14:
        //   alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fourteen;
        //   break;
        // case 15:
        //   alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_fifteen;
        //   break;
        case 16:
          alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0'+this.main.lifeAlart_sixteen;
          alertItem.color = this.showColorByType(alertItem.alertType);
          this.addAlertFirstPosition(alertItem)
          break;
        case 17:
          alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_seventeen;
          alertItem.color = this.showColorByType(alertItem.alertType);
          this.addAlertFirstPosition(alertItem)
          break;
        case 20:
          alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twenty;
          alertItem.color = this.showColorByType(alertItem.alertType);
          this.addAlertFirstPosition(alertItem)
          break;
        case 21:
          if(alertItem.location!="" && alertItem.location!=null && alertItem.location!=undefined){
            alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyone;
          }else{
            alertItem.alertInfoTwo=this.main.lifeAlart_twentyone;
          }
          this.addAlertFirstPosition(alertItem)
          break;
        case 22:
          if(alertItem.location!="" && alertItem.location!=null && alertItem.location!=undefined){
            alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentytwo;
          }else{
            alertItem.alertInfoTwo=this.main.lifeAlart_twentytwo;
          }
          this.addAlertFirstPosition(alertItem)
          break;
        case 23:
          if(alertItem.location!="" && alertItem.location!=null && alertItem.location!=undefined){
            alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentythree;
          }else{
            alertItem.alertInfoTwo=this.main.lifeAlart_twentythree;
          }
          this.addAlertFirstPosition(alertItem)
          break;
        case 24:
          if(alertItem.location!="" && alertItem.location!=null && alertItem.location!=undefined){
            alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyfour;
          }else{
            alertItem.alertInfoTwo=this.main.lifeAlart_twentyfour;
          }
          this.addAlertFirstPosition(alertItem)
          break;
        case 27:
          if(alertItem.location!="" && alertItem.location!=null && alertItem.location!=undefined){
            alertItem.alertInfoTwo=alertItem.location+"号室"+'\xa0\xa0\xa0\xa0'+this.main.lifeAlart_twentyseven;
            // item.fontSize
                  if(item.fontSize == '0'){
                    item.fontSize = '12px'; 
                  }else if(item.fontSize == '1'){
                    item.fontSize = '14px'; 
                  }else if(item.fontSize == '2'){
                    item.fontSize = '16px'; 
                  }else if(item.fontSize == '3'){
                    item.fontSize = '18px'; 
                  }else if(item.fontSize == '4'){
                    item.fontSize = '20px'; 
                  }else if(item.fontSize == '5'){
                    item.fontSize = '22px'; 
                  }else if(item.fontSize == '6'){
                    item.fontSize = '24px'; 
                  }
          }else{
            alertItem.alertInfoTwo=this.main.lifeAlart_twentyseven;
          }
          break;
      }
      //item.color
    },
    //接受到信息时
    websocketonmessage(ev) {
      //数据接收
      //通过后台返回的字段去判断
      if (ev.data) {
        // this.queryAlert();
        //by fzq 2019-11-14-14:38 修改 websocket的推送消息需要分类处理
        let data=JSON.parse(ev.data);//将json对象转换成对象
        //判断show ==0 弹框不弹出   show ==1 弹框弹出
        //判断data.msgType == web_alert_refresh  报警记录的消息推送的类型  只有收到报警记录的消息推送才去通知其他页面去刷新报警的数量和列表的数据
        if (data.msgType == "web_alert_refresh") {
          if(data.content.length>13){
            var alertBean=JSON.parse(data.content);
            // alertBean是一个Obj;
            // alertBean.alert是一个数组
            if(alertBean.operate == "delete"){
              // alertBean.alert.forEach(item =>{
              //   console.log(item);
              //   this.rmAlertById(item.id);
              // })
              //查询
              this.queryAllAlert();
            }else if(alertBean.operate == "insert"){
              // alertBean.alert.forEach(item =>{
              //   this.addAlertByMsg(item);
              // })
              this.queryAllAlert();
            }
            this.$bus.$emit("changeLifeAlarm_room",data.content);
          }
          if(data.show==1){
            this.suportNotify(ev.data); //调取方法 接收推送的消息 by 2019-10-09 11:25
          }
        }else if(data.msgType == "web_color_refresh"){
          //报警色刷新通知  by fzq
          this.$bus.$emit("change_alarm_color");//life集团的报警通知刷新页面
          this.querylifeAlarmColor();//本页面查询报警色

        }else if(data.msgType == "web_status_refresh"){
          //首页房间状态变更  by fzq
          //this.$bus.$emit("changeLife_roomStatus");//life集团的刷新房间一览 详情页面的老人在离房状态和设备未知的数据
          // if(data.content.length>13){
            // }
            this.$bus.$emit("changeLife_roomStatus", data.content);
          
        }else if(data.msgType == "web_card_refresh"){//by guo 2020-3-25-20:46添加
          this.$bus.$emit("doormessage", {
              title:data.title,
              message:data.content,
              name:data.name});

        }else{
          this.$bus.$emit("change_Schedule");//去刷新待办事项的数量
          if(data.show==1){
            this.suportNotify(ev.data); //调取方法 接收推送的消息 by 2019-10-09 11:25
          }
        }
      }
    },
    //发送信息时
    websocketsend(Data) {
      //数据发送
      if(this.websock!=null && this.websock!="" && this.websock.readyState===1){
        this.websock.send(Data);
      }
    },
    //关闭时
    websocketclose(ev) {
      //关闭
      setInterval(()=>{
        //readyState == 3  websocket断开了   
        //断开重连
        if(this.websock!=null&&this.websock!=''&&this.websock.readyState == 3){
          if(this.userId!=null){//userId必须存在才重新连接
            this.initWebSocket();
          }
        }
      },1000)
      //by guo 2020-1-21-14:52 注释
      // if(this.language=="zh_CN"){//如果是日本life项目====this.language为"ja_JP" 就不再重连  否则是武昌福利院平移项目this.language=="zh_CN"就重连websocket
      //   setInterval(()=>{
      //     //readyState == 3  websocket断开了   
      //     if(this.websock.readyState == 3){
      //       if(this.userId!=null){//userId必须存在才重新连接
      //         this.initWebSocket();
      //       }
      //     }
      //   },1000)  
      // }
    },
    //推送弹框消息  by guo 2019-10-09 11:25
    suportNotify(info) {
      var showMsg = info;
      if (window.Notification) {
        // 支持
        console.log("支持" + "Web Notifications API");
        //如果支持Web Notifications API，再判断浏览器是否支持弹出实例
        this.showMess(showMsg); //调取消息提示框的函数
      } else {
        // 不支持
        alert("不支持 Web Notifications API");
      }
    },
    showMess(data) {
      var objData=JSON.parse(data);//将json字符串转换成对象
      console.log(objData);
      var title = objData.title;
      var msg = objData.content;
      var urlPath = objData.url;//by guo 2019-11-14 15:02 添加  配置的需要跳转的url
      var messageType = objData.msgType;
      console.log(title,msg,urlPath,this.roleCode,messageType);
      this.$bus.$emit("change_todoItemNumber"); //发送一个change事件 去改变待办事项右上角的数量
      setTimeout(()=> {
        console.log("1：" + Notification.permission);
        //如果支持window.Notification 并且 许可不是拒绝状态
        if (window.Notification && Notification.permission !== "denied") {
          //Notification.requestPermission这是一个静态方法，作用就是让浏览器出现是否允许通知的提示
          Notification.requestPermission((status)=> {
            console.log("2: " + status);
            //如果状态是同意
            if (status === "granted") {
              var notify = new Notification(title, {
                body: msg, //消息体内容
                //tag: 'avenstar', //代表通知的一个识别标签，相同tag时只会打开同一个通知窗口
                icon: require("../../resource/logo.png"),
                data: {
                  url: "" //跳转页面的url
                },
                silent: true, //true代表有声，false代表无声
                sound: "../img/notification.mp3", //铃声文件的url
                requireInteraction: true //通知自动关闭,  true不关闭   默认为false 关闭
              });
              notify.onshow = ()=> {
                console.log("通知显示了！");
               
              };
              notify.onclick = ()=> {
                console.log(this.roleCode,"fjewjgjerhjejhjjeh")
                //by guo 2020-6-19-17:10 修改  因为新增了一个商家下单的推送通知 需要判断 
                if(messageType=='merchant_order_need_ensure'){//商家接到下单通知的messageType
                  if(this.roleCode=='business'){
                    if(sessionStorage.getItem('activityTab')=='/BusinessWorkOrder'){//判断是否是当前商家工单管理的页面 是的话就通知刷新数据，就不需要跳转页面
                      this.$bus.$emit("change_BusinessWorkOrder"); //发送一个change事件 去刷新商家订单的分页查询列表
                    }else{
                      bus.$emit("homePage", {
                        type: "jump",
                        path: urlPath,
                        title: "商家工单管理"
                      });
                    }
                  }
                }else{
                  if(this.roleCode=='home' || this.roleCode=='serviceMinister' || this.roleCode=='medicalMinister' || this.roleCode=='receptionist' || this.roleCode=='receptionMinister' || this.roleCode=='charge' || this.roleCode=='evaluate'){
                    bus.$emit("homePage", {
                      type: "jump",
                      path: urlPath,
                      title: "待办事项"
                    });
                  }
                }
                //by guo 2020-6-19-17:07 注释掉
                //点击当前消息提示框后，跳转到待办事项
                //判断哪些角色有待办事项 才可以跳转
                // if(this.roleCode=='home' || this.roleCode=='serviceMinister' || this.roleCode=='medicalMinister' || this.roleCode=='receptionist' || this.roleCode=='receptionMinister' || this.roleCode=='charge' || this.roleCode=='evaluate'){
                //   bus.$emit("homePage", {
                //     type: "jump",
                //     path: urlPath,
                //     title: "待办事项"
                //   });
                // }
                notify.close(); //跳转页面后关闭消息提示框
              };
              notify.onclose = ()=> {
                console.log("你关闭了我！！！");
              };
              notify.onerror = (err)=> {
                console.log("出错了！！！");
                throw err;
              };

            } else {
              alert("当前浏览器不支持弹出消息");
            }
          });
        } else {
          console.log("--------",title,msg,this.roleCode);
          var that=this
          this.$notify({
            title: title,
            message: msg,
            iconClass: "el-icon-eleme",
            customClass:"",
            duration: 0,
            position: "bottom-right",
            showClose() {
              console.log("aaaa");
            },
            onClose() {
              console.log("bbbb");
            },
            onClick() {
              console.log("cccc",this.roleCode,that.roleCode);
              //by guo 2020-6-19-17:05 修改 因为新增了一个商家下单的推送通知 需要判断
              if(messageType=='merchant_order_need_ensure'){//商家接到下单通知的messageType
                if(that.roleCode=='business'){
                  if(sessionStorage.getItem('activityTab')=='/BusinessWorkOrder'){//判断是否是当前商家工单管理的页面 是的话就通知刷新数据，就不需要跳转页面
                    this.$bus.$emit("change_BusinessWorkOrder"); //发送一个change事件 去刷新商家订单的分页查询列表
                  }else{
                    bus.$emit("homePage", {
                      type: "jump",
                      path: urlPath,
                      title: "商家工单管理"
                    });
                  }
                }
              }else{
                //判断哪些角色有待办事项 才可以跳转
                if(that.roleCode=='home' || that.roleCode=='serviceMinister' || that.roleCode=='medicalMinister' || that.roleCode=='receptionist' || that.roleCode=='receptionMinister' || that.roleCode=='charge' || that.roleCode=='evaluate'){
                  bus.$emit("homePage", {
                    type: "jump",
                    path: urlPath,
                    title: "待办事项"
                  });
                }
              }
              //by guo 2020-6-19-17:07 注释掉
              // //判断哪些角色有待办事项 才可以跳转
              // if(that.roleCode=='home' || that.roleCode=='serviceMinister' || that.roleCode=='medicalMinister' || that.roleCode=='receptionist' || that.roleCode=='receptionMinister' || that.roleCode=='charge' || that.roleCode=='evaluate'){
              //   bus.$emit("homePage", {
              //     type: "jump",
              //     path: urlPath,
              //     title: "待办事项"
              //   });
              // }


              this.close();
            }
          });
        }
      }, 100);
    },
    getIcon(){
      if(this.isHuaLong){
        let icon_url = '../static/chongming.ico'
        let link = document.querySelector("link[rel*='icon']") || document.createElement('link');
        link.type = 'image/x-icon';
        link.rel = 'shortcut icon';
        link.href = icon_url;
        document.getElementsByTagName('head')[0].appendChild(link);
      }
    },
    getTitle(){
      if(this.isHuaLong){
        let title = document.getElementsByTagName('title');
        title[0].innerHTML = '崇明福利院';
      }
    },
  },
  created() {
    //获取护工组id
    this.getNursingGroupId();
    //解决token过期问题
    this.tokenTime = setInterval(() => {
      this.getToken();
    }, 20 * 60 * 1000);
    //获取机构id
    this.getUserData();
    this.groupId = sessionStorage.getItem("groupId");
    this.roleCode = sessionStorage.getItem('roleCode');//by guo 2019-11-14-18:37添加  获取用户的角色code  用于判断哪些角色有待办事项
    this.activityTab=sessionStorage.getItem('activityTab');//by guo 2019-11-19-15-22添加  储存右边tab 选项卡的选中的项
    
    //
    var that = this;
    this.$nextTick(() => {
      var scrollDiv = document.getElementById('scrollDiv');
      //绑定事件
      const offsetHeight = scrollDiv.offsetHeight;
      scrollDiv.addEventListener('scroll', function() {
          if(offsetHeight + scrollDiv.scrollTop + 1 > scrollDiv.scrollHeight){
            if(!this.lifeAlarmLoading){
              that.alertPageNo ++;
              console.log('scroll =========== scroll');
              that.queryAlertPage();
            }
          }
      });
    });
  },
  /**
   * 页面加载完毕后执行该方法
   */
  mounted() {
    this.getToken();
    //请求菜单数据
    this.getPageData();
    setTimeout(()=>{
      if(this.groupId!=null){
        this.queryLanguage(this.groupId);//by guo 2020-01-21-13:19 获取机构的语言  中文或者其他语言
      }
    },500)
    //接收子界面发送的eventBus消息,进行判断消息跳转等操作
    bus.$on("homePage", msg => {
      this.geteventBusMshJump(msg);
    });
    //获取机构id
    //this.getUserData();
    //获取护工组id
    //this.getNursingGroupId();
    //获取基础护理费
    //报警未处理数据
    // this.getAlarmlogDetail();
    //基础人员类别
    //life集团首页报警提示查询 by guo 2019-12-27-16:46添加
    //1.查询报警颜色
    this.querylifeAlarmColor();
    //2.查询报警列表
    // this.queryDeviceAlertLife();
    // this.queryAllAlert();
    // bus.$on("refreshLifeAlarmMain",()=>{
    //   console.log("设施管理修改颜色刷新颜色")
    //   // this.queryDeviceAlertLife();
    //   // this.querylifeAlarmColor();
    // })
    // this.$bus.$on("changeLifeAlarm_websocket",()=>{
    //   console.log("刷新life首页报警提示的数据")
    //   // this.queryDeviceAlertLife();
    // })
    // this.$bus.$on("refreshalarmTitle",()=>{
    //   console.log("接收到房间详情页面报警列表，刷新房间一览房间列表")
    //   // this.queryDeviceAlertLife();
    // });
    //先注释掉
    // this.$bus.$on("openWebsocketRoomVideo",()=>{
    //   console.log("重新开启websocket");
    //   this.initWebSocket();
    // })
    // this.$bus.$on("closeWebsocketRoomVideo",()=>{
    //   console.log("关闭websocket");
    //   this.websock.close();
    // })
    // this.$bus.$on('roomWebsocket',()=>{
    //   console.log("房间一览详情页面销毁")
    //   this.initWebSocket();
    // })
  },
  //by guo 2019-11-15-12:33 添加  退出登录 组件被销毁  清除websocket
  destroyed() {
    if(this.websock!=null && this.websock!=""){
      this.websock.close(); //退出登录之后断开websocket连接
       this.websock = null;
    }else{
      this.websock = null;
    }
    clearInterval(this.tokenTime);
    sessionStorage.removeItem('userId');//销毁userId
    this.userId=null;
  },
};
</script>

<style scoped>
/* by guo 2020-2-25-11:23添加 main-right*/
.main-right{
  min-width: 1300px;
}

/* by guo 2020-3-13-11-02修改 */
@media (max-width: 1023px){ 
  .main-right{
    min-width: 1150px;
  }
}
@media (min-width: 1024px){ 
  .main-right{
    min-width: 1150px;
  }
}  

@media (min-width: 1200px){ 
  .main-right{
    min-width: 1150px;
  }
}  
@media (min-width: 1300px){ 
  .main-right{
    min-width: 1150px;
  }
}  

@media (min-width: 1400px){ 
  .main-right{
    min-width: 1300px;
  }
}  

@media (min-width: 1500px){ 
  .main-right{
    min-width: 1300px;
  }
}  
.home_icon {
  width: 24px;
  display: inline-block;
  text-align: center;
}
.el-container {
  height: 100%;
}
.nooverflow {
  overflow-x: hidden;
  overflow-y: hidden;
}
/* .el-menu {
  height: 100%;
} */
/*by guo 2019-7-15 添加  菜单多了 需要y轴的滚动条*/
.divMenu {
  height: 100%;
  background: #363636;
}
.el-menu {
  /* height: 650px; */
  height: calc(100% - 80px);
  overflow-y: auto;
  overflow-x: hidden;
}
.left-menu{
  --height: 100%;
}
.el-menu-item{
  max-width: 200px!important;
  overflow:hidden !important; 
  text-overflow:ellipsis !important; 
  white-space:nowrap !important; 
}

.el-menu-item-group__title {
  padding: 0px;
}
.left_top_icon_bg {
  background: #3a77e2;
  height: 80px;
  display: flex;
  align-items: center;
}
.left_top_icon_bg_hualong{
  background-image: linear-gradient(to bottom, #FF8C00, #FFAF00);
  height: 80px;
  display: flex;
  align-items: center;
}
.badge {
  float: right;
  margin-right: 30px;
  margin-top: 6px;
  cursor: pointer;
}
.marginLeftTen {
  margin: 0 10px;
}
.textspan {
  font-size: 16px;
  margin-left: 10px;
  color: #d2691e;
  font-weight: bold;
}
/* by guo 2019-12-09-20:02 添加 */
.leftAside{
  height: calc(100% - 95px);;
  width:15%;
  min-width: 230px;
  background-color: #444444;
  color: #FE0000;
  text-align: center;
  position: fixed;
  top:95px;
  right:0;
  overflow-x: hidden;
  overflow-y:auto;
  z-index: 2000;/* by guo 2020-2-25-11:26添加 */
}
/*by guo 2019-12-27-11:52 添加的文字滚动的动画 */
  .animate {
    padding-left: 20px;
    font-size: 16px;
    /* color: #FE0000; */
    display: inline-block;
    white-space: nowrap;
    animation: 10s wordsLoop linear infinite normal;
  }
 
  @keyframes wordsLoop {
    0% {
      transform: translateX(200px);
      -webkit-transform: translateX(200px);
    }
    100% {
      transform: translateX(-100%);
      -webkit-transform: translateX(-100%);
    }
  }
 
  @-webkit-keyframes wordsLoop {
    0% {
      transform: translateX(200px);
      -webkit-transform: translateX(200px);
    }
    100% {
      transform: translateX(-100%);
      -webkit-transform: translateX(-100%);
    }
  }
  .row-lingdang{
    width:80%;
    margin:0 auto;
    height:50px;
    line-height:50px;
    font-size:18px;
  }
  .row-lingdang-icon{
    font-size:20px;
  }
  .row-lingdang img{
    vertical-align: middle;
  }
  .alarmMessage{
    text-align: left;
    text-indent: 15px;
    height:30px;
    line-height:30px;
    padding-bottom:25px; 
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
</style>
<style lang="scss">
//动态去掉el-menu的箭头,不用设置成scoped,由于给他绑定了一个样式,穿透不出去
#nprogress .bar {
}
#nprogress .spinner {
  // box-shadow: 0 0 10px #FFBB00, 0 0 5px #FFBB00;
  margin-right: 50%;
  margin-top: 200px;
}
#nprogress .spinner-icon{
  width:28px;
  height: 28px;
}
.submenu {
  .el-submenu__icon-arrow {
    display: none;
  }
}
.el-menu-item.is-active {
  color: white;
}
.el-image-viewer__close{
  .el-icon-circle-close{
    color: red;
  }
}

@keyframes blink{
  0%{opacity: 1;}
  50%{opacity: 1;}
  50.01%{opacity: 0;} /* 注意这里定义50.01%立刻透明度为０，可以设置闪烁效果 */
  100%{opacity: 0;}
}
 
/* 添加兼容性前缀 */
 
@-webkit-keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 1; }
    50.01% { opacity: 0; }
    100% { opacity: 0; }
}
 
@-moz-keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 1; }
    50.01% { opacity: 0; }
    100% { opacity: 0; }
}
 
@-ms-keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 1; }
    50.01% { opacity: 0; }
    100% { opacity: 0; }
}
 
@-o-keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 1; }
    50.01% { opacity: 0; }
    100% { opacity: 0; }
}

/* 定义blink类*/
.blink{
    animation: blink .75s linear infinite; 
    /* 其它浏览器兼容性前缀 */
    -webkit-animation: blink .75s linear infinite;
    -moz-animation: blink .75s linear infinite;
    -ms-animation: blink .75s linear infinite;
    -o-animation: blink .75s linear infinite;
}

</style>



